package com.bwie.service.impl;

import com.bwie.mapper.AttrMapper;
import com.bwie.pojo.Attr;
import com.bwie.service.AttrService;
import com.bwie.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author GaoYiJie
 * @Description
 * @Create 2025/2/27 9:49
 * @Version 1.0
 */
@Service
public class AttrServiceImpl implements AttrService {

    @Autowired
    AttrMapper attrMapper;

    @Override
    public R getAttrList() {
        List<Attr> attrs = attrMapper.selectList(null);
        return R.OK(attrs);
    }

    @Override
    public R addAttr(Attr attr) {
        attrMapper.insert(attr);
        return R.OK();
    }

    @Override
    public R updateAttr(Attr attr) {
        attrMapper.updateById(attr);
        return R.OK();
    }

    @Override
    public R deleteAttr(Integer attrId) {
        attrMapper.deleteById(attrId);
        return R.OK();
    }
}
